<!DOCTYPE html>

<head>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="/js/vue.js">
    </script>

</head>



<body>

    <div id="app">
        <h1>成绩</h1>
        <component1 :score="50"></component1>
        <component1 :score="96"></component1>
        <component1 :score="90"></component1>
        <component1 :score="100"></component1>

    </div>


    <script>

        Vue.component('component1',{
            props:['score'],
            template:`
            <div>
              {{score}}分，{{testResult}}  
            </div>    
            `,

            computed:{
                testResult(){
                    var strResult = "";
                    if(this.score<60)
                    strResul="不及格";
                    else if(this.score<90)
                    strResul="中等生";
                    else if(this.score<=100)
                    strResul="优秀生";
                    return strResul



                }
         }
  })


        var vm = new Vue({
            el: '#app',
            data: {},
            methods: {}
        })

    </script>


</body>

</html>